﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace OCRTheNewHope
{
    public static class Parameters
    {
        public static DateTime StartingTime = DateTime.Now;

        public static int NumImagesEachTree = 120000;
        public static int NumTree = 100;
        public static int TotalTestDigits = 10000;
        public static int UsedFeatureCountAtEveryNode = 80;
        public static int MaxDepth = 10;
        public static int NumberOfThresholds = 20;
        public static int[] SelectedDigits = { 4, 9 };
        public static string GlobalLogPath;
        public static string GlobalImagePath;

        public static int numClasses = Parameters.SelectedDigits.Length;
        public static double MaxEntropy = Math.Log(numClasses, 2);
        public static double EntropyThreshold = Parameters.MaxEntropy / 1000;
        
        public static string TrainPath = "C:\\BIG-heavy.data";
        public static string TestPath = "C:\\test.data";

        public static string Log()
        {
            string rVal = "";

            foreach (FieldInfo field in typeof(Parameters).GetFields())
            {
                if (field.FieldType == typeof(int[]))
                {
                    string temp = "{ ";

                    int[] tempArr = (int[])field.GetValue(null);

                    for (int i = 0; i < tempArr.Length; i++)
                    {
                        temp += tempArr[i].ToString() + ", ";
                    }

                    temp += "}";

                    rVal += String.Format("{0} = {1}" + Environment.NewLine, field.Name, temp);
                }
                else
                {
                    rVal += String.Format("{0} = {1}" + Environment.NewLine, field.Name, field.GetValue(null));
                }
            }

            return rVal;
        }
    }
}
